<%@ page import="org.biojava.services.das.dao.Role" %>
<%@ page import="org.biojava.services.das.dao.RegistryUser" %>
<%@ page import="org.biojava.services.das.registry.UserManager" %>
<jsp:directive.page import="org.springframework.beans.factory.BeanFactory"/>
<jsp:directive.page import="org.springframework.context.support.ClassPathXmlApplicationContext"/>
<jsp:directive.page import="java.security.Principal"/>
<jsp:directive.page import="java.util.*"/>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head >
        <title>DAS registration - server</title>
        <link rel="stylesheet" type="text/css" href="stylesheet.css" />
        <link rel="stylesheet" type="text/css" href="pagination.css" />
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />

        <script type="text/javascript" src="javascripts/jquery.js"></script>
        <script type="text/javascript" src="javascripts/jquery.getUrlParam.js"></script>
        <!--    <script type="text/javascript" src="custom.js"></script>-->
        <script type="text/javascript" src="jquery.tooltip.js"></script>


        <script type="text/javascript" src="javascripts/jquery.pagination.js"></script>
        <script language="JavaScript" type="text/javascript" src="javascripts/jsdas.0.1.3.js"></script>
        <!-- <script type="text/javascript" src="javascripts/sourcesGetter.js"></script> -->
        <!--<script language="JavaScript" type="text/javascript" src="jsdebug.js"></script>
        <script src="file.js?${config.startupTime}"></script>
        -->
        <script type="text/javascript" src="javascripts/customreg.js?${config.startupTime}"></script>
        <script type="text/javascript" src="javascripts/listSources.js?${config.startupTime}"></script>
        <script type="text/javascript" src="javascripts/solrSearch.js?${config.startupTime}"></script>
        <script type="text/javascript" src="javascripts/listServers.js?${config.startupTime}"></script>

        <script type="text/javascript" src="javascripts/dropdown.js"          language="javascript" ></script>
        <script type="text/javascript" src="javascripts/DynamicOptionList.js" language="javascript" ></script>
        <script type="text/javascript" src="http://js.sanger.ac.uk/urchin.js" ></script>
        <%

        //Cookie[] cookies1=request.getCookies();
        //if (cookies1 != null) {
            //for (int i = 0; i < cookies1.length; i++) {

            //System.out.println("cookie name="+cookies1[i].getName()+"  cookie value="+cookies1[i].getValue()+" cookie path="+cookies1[i].getPath()+cookies1[i].getDomain());
            //}
        //}
            //String email = (String) session.getAttribute("email");
        //System.out.println("session id="+session.getId());
            Enumeration enumeration = session.getAttributeNames();
            while (enumeration.hasMoreElements()) {
                String key = (String) enumeration.nextElement();
                Object value = (Object) session.getAttribute(key);
                //System.out.println("attributes in session:"+key+"="+value);

            }

            String email = (String) session.getAttribute("email");
            RegistryUser user = new RegistryUser();
            boolean isAdmin = false;
            UserManager um = null;
            if (email != null) {
                BeanFactory ctex = (new ClassPathXmlApplicationContext("SpringDAO.xml"));
                um = (UserManager) ctex.getBean("userManager");
                user = um.getUser(email);
                if (Role.isAdmin(user)) {
                    isAdmin = true;
                }
            }
        %>  
    </head>